import {Component, Input, OnInit} from '@angular/core';
import {DocApi} from '../../entity/doc-api';
import {EntityRef} from '../../entity/entity-ref';
import {Entity} from '../../entity/entity';
import {Artifact} from '../../entity/artifact';
import {User} from '../../entity/user';
import {UserService} from '../../service/user.service';
import {ParamEntity} from '../../entity/param-entity';

@Component({
    selector: 'app-page-api-dubbo',
    templateUrl: './page-api-dubbo.component.html',
    styleUrls: ['./page-api-dubbo.component.css']
})
export class PageApiDubboComponent implements OnInit {

    @Input()
    api: DocApi;

    /**
     * 接口版本号
     */
    @Input()
    apiVersion: string | number;

    @Input()
    artifact: Artifact;

    /**
     * 实体类参数，需要展示内部结构
     */
    @Input()
    paramEntities: ParamEntity[];

    @Input()
    entryRefMap: Map<EntityRef, Entity>;

    @Input()
    response: EntityRef;

    /**
     * Dubbo已开通的环境
     */
    @Input()
    envs: string[];

    user: User;

    constructor(
        private userService: UserService
        ) {
    }

    ngOnInit() {
        this.user = this.userService.getUser();
    }
}
